package io;

import java.io.*;
import java.util.Scanner;

/**
 * 使用流连接完成PW的创建
 */
public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        PrintWriter pw = new PrintWriter(new BufferedWriter //缓冲字符流
                (new OutputStreamWriter //转换字符流
                        (new FileOutputStream //文件字节流
                                ("pw.txt",true))),true);
        Scanner scan = new Scanner(System.in);
        while (true){
            System.out.println("输入：");
            String s = scan.next();
            if ("exit".equalsIgnoreCase(s)) {
                break;
            }else {
                pw.println(s);
            }
        }
        pw.close();
    }
}
